/******************************************************************************
** @file	test_sqlite3x_reader.cpp
** @author  Joel Chuca Condo
**
** @date	Sep 01, 2010
**
** @desc	This testSuite tests sqlite3x_command class
*			
******************************************************************************/

#include "unit--/unit--.h"
#include "sqlite3x.hpp"

#include <iostream>
#include <stdexcept>

using namespace sqlite3x;
using namespace unit_minus;
using namespace std;

testSuite(DatabaseLayer);

testCase(binExecutenonqueryTest, DatabaseLayer)
{
    sqlite3_connection con("test.db");
    sqlite3_transaction trans(con);
	{
		sqlite3_command cmd(con, "insert into computer (computer_id, name, wname, installDate)values(NULL,?,?,?);");
		cmd.bind(1, "name01", 6);
        cmd.bind(2, wstring(L"name01"));
        cmd.bind(3, 1092941466);            
		cmd.executenonquery();		
	}
    con.close();
}

testCase(executenonqueryTest, DatabaseLayer)
{
    sqlite3_connection con("test.db");
    string script = "CREATE TABLE computer ( "
        "computer_id  integer PRIMARY KEY AUTOINCREMENT NOT NULL, "
        "name        varchar(255) , "
        "wname        varchar(255), "
        "installDate integer );";

    con.executenonquery(script);
    con.close();
}